package com.android.panballgame;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;

public class PBHelp extends Activity{

	public static ImageButton point1, point2;
	public static ImageView help1, help2, help3, help4;
	private int btnum = 1;

	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.help);
		
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);//화면 꺼짐 방지
		
		point1 = (ImageButton) findViewById(R.id.btnhelp1);
		point2 = (ImageButton) findViewById(R.id.btnhelp2);
		help1 = (ImageView) findViewById(R.id.help1);
		help2 = (ImageView) findViewById(R.id.help2);
		help3 = (ImageView) findViewById(R.id.help3);
		help4 = (ImageView) findViewById(R.id.help4);
		
		point1.getBackground().setAlpha(PBEngine.MENU_BUTTON_ALPHA);
		point1.setHapticFeedbackEnabled(PBEngine.HAPTIC_BUTTON_FEEDBACK);
		point2.getBackground().setAlpha(PBEngine.MENU_BUTTON_ALPHA);
		point2.setHapticFeedbackEnabled(PBEngine.HAPTIC_BUTTON_FEEDBACK);
		
		point1.setOnClickListener(new ImageButton.OnClickListener() {//오른쪽 버튼

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				btnum = btnum+1;
				visible();
			}
		});	
		point2.setOnClickListener(new ImageButton.OnClickListener() {//왼쪽 버튼

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				btnum = btnum-1;
				visible();
				
			}
		});	
	}
	private void visible(){
		
		help1.setVisibility(View.GONE);
		help2.setVisibility(View.GONE);
		help3.setVisibility(View.GONE);
		help4.setVisibility(View.GONE);
		point1.setVisibility(1);
		point2.setVisibility(1);
		if(btnum == 1){
			help1.setVisibility(View.VISIBLE);
			point2.setVisibility(View.GONE);			
		}			
		else if(btnum == 2){
			help2.setVisibility(View.VISIBLE);
		}
		else if(btnum == 3){
			help3.setVisibility(View.VISIBLE);
		}
		else if(btnum == 4){
			help4.setVisibility(View.VISIBLE);
			point1.setVisibility(View.GONE);
		}	
	}
}

